package thinkingJava.chapter13;

import java.util.Arrays;
import java.util.Scanner;
import java.util.StringTokenizer;

public class ReplacingStringTokenizer {
	public static void main(String[] args) {
		String input = "But I'm not dead yet! I feel happy!";
		StringTokenizer stoken = new StringTokenizer(input);
		while (stoken.hasMoreElements()) {
			System.out.print(stoken.nextToken() + "  ");
		}
		System.out.println();
		System.out.println("-----------------------------------------");
		System.out.println(Arrays.toString(input.split(" ")));
		System.out.println("-----------------------------------------");
		Scanner sc = new Scanner(input);
		while (sc.hasNext()) {
			System.out.print(sc.next() + "  ");
		}
	}
}
